//
//  ViewController.swift
//  JLUserInfo
//
//  Created by JiangChencheng on 07/31/2024.
//  Copyright (c) 2024 JiangChencheng. All rights reserved.
//

import UIKit
import JLUserInfo

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        getLoggedUserInfo()
    }
    
    func getLoggedUserInfo() {
        guard let userInfo = LoggedUser() else {
            Task {
                do {
                    let result = try await JLUserCenter.login()
                    if result == true {
                        getLoggedUserInfo()
                    }
                }catch {
                    print("\(error)")
                }
            }
            return
        }
        print("uid:\(userInfo.uid)")
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}

